﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace PrintDrawing
{
    /// <summary>
    /// Interaction logic for MakeSiteText.xaml
    /// </summary>
    public partial class MakeSiteText : UserControl
    {
        Window win;
        public MakeSiteText(Window w)
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MakeSiteText_Loaded);
            win = w;
        }
        Popup Pop;
        public MakeSiteText(Popup w)
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MakeSiteText_Loaded);
            Pop = w;
        }
        void MakeSiteText_Loaded(object sender, RoutedEventArgs e)
        {
            setBinding();
        }
        TextBox _txt=new TextBox();

        public TextBox Txt
        {
            get { return _txt; }
            set { _txt = value; }
        }
        public void setBinding()
        {
            //this.slider1.Value=
            Binding nameTextBinding = new Binding("Width");
            nameTextBinding.Source = Txt;
            this.slider1.SetBinding(Slider.ValueProperty, nameTextBinding);

            Binding valueBinding = new Binding("Value");
            valueBinding.Source = slider1;
            this.label1.SetBinding(Label.ContentProperty, valueBinding);

            //this.slider2.Value=
            Binding nameTextBinding2 = new Binding("Height");
            nameTextBinding2.Source = Txt;
            this.slider2.SetBinding(Slider.ValueProperty, nameTextBinding2);

            Binding valueBindingRong = new Binding("Value");
            valueBindingRong.Source = slider2;
            this.lblrong.SetBinding(Label.ContentProperty, valueBindingRong);
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (win != null)
            {
                win.Close();
            }
            if (Pop != null)
            {
                Pop.IsOpen = false;
            }
        }
    }
}
